package com.dm.cloud.images.mapper;

import com.dm.cloud.tkmybatis.service.BaseMapper;
import com.dm.cloud.images.common.po.ImagesContainer;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
   * @author hcx
   * @type ImagesContainerMapper.java
   * @desc ImagesContainer mapper
   */

@Mapper
public interface ImagesContainerMapper extends BaseMapper<ImagesContainer> {

    @Select("select * from T_IMAGES_CONTAINER where container_id=#{containerId} and node_id=#{nodeId}")
    ImagesContainer findImageContaniner(@Param("nodeId") String nodeId,@Param("containerId") String containerId);

    @Delete("delete from T_IMAGES_CONTAINER where container_id=#{containerId} and node_id=#{nodeId}")
    int deleteByContaniner(@Param("nodeId") String nodeId,@Param("containerId") String containerId);

    @Select("select * from T_IMAGES_CONTAINER where app_code=#{appCode}")
    List<ImagesContainer> findImageContaninerByAppcode(@Param("appCode") String appCode);
    @Update("update T_IMAGES_CONTAINER set app_code=null where container_id=#{containerId} and node_id=#{nodeId}")
    int clearContanierAppCode(@Param("nodeId") String nodeId,@Param("containerId") String containerId);
}
